@extends('layouts.back_stage')
@section('style')
@section('content')
    <link rel="stylesheet" href="{{env('CDN_DOMAIN_NAME')}}/css/clothInfo.css"/>
    <link href="{{env('CDN_DOMAIN_NAME')}}/css/jcDate.css" rel="stylesheet">

    <div class="container">
        <div style="margin:30px;"><h3 >采购入库</h3></div>
        <ul class="lining-ul">
            <li id="ingred" class="lining-li">
                <form action="/storage/index" type="post">
                    <div style="overflow: hidden;">
                        <p class="seek_p">
                            <label class="seek_lab supplier_id2" name="supplier" style="width:190px;">供应商：
                                <select class="ingred_sel" name="supplier">
                                    @if($where->supplier)
                                        <option value="{{ $where->supplier }}">{{ $supplier[$where->supplier] }}</option>
                                        @else
                                        <option value="">请选择</option>
                                        @endif

                                    @if(count($supplier) > 0)
                                        @foreach($supplier as $k=>$v)
                                            <option value="{{ $k }}">{{ $v }}</option>
                                            @endforeach
                                        @endif
                                </select>
                            </label>
                            <label class="seek_lab1" style="width:250px;">日期:
                                <input type="text" class="ingred_sel jcDate" name="end_at" value="{{ $where->start_at }}" placeholder="结束时间" style="width:100px;">
                                <span style="float:right;margin:2px;">-</span>
                                <input type="text" class="ingred_sel jcDate" name="start_at" value="{{ $where->end_at }}" placeholder="开始时间" style="width:100px;">
                            </label>
                            <button class="btn bt_del btn-info" href="javascript:;" >搜索</button>
                            <a class="btn bt_del btn-info" href="javascript:;" onclick="emptyIngred()">清空</a>
                        </p>
                    </div>
                </form>
                <div class="fabric_list">
                    <span style="display:none;" class="info_sum">{{$list_count}}</span>
                    <table class="pantone" border="1" cellspacing="0" cellpadding="0">
                        <tr>
                            <td>采购计划单号</td><td>供应商</td><td>数量</td><td>金额</td><td>采购下达日期</td><td>到货状态</td><td>采购类型</td><td>操作</td>
                        </tr>
                        @if(count($list) > 0)
                            @foreach($list as $v)
                                <tr>
                                    <td>{{ $v->plan_code }}</td>
                                    <td>{{ $supplier[$v->supplier] }}</td>
                                    <td>{{ $v->num }}</td>
                                    <td>{{ $v->price }}</td>
                                    <td>{{ $v->created_at }}</td>
                                    <td>
                                        @if($v->pro_status)
                                            <p style="color: green">已全部入库</p>
                                            @else
                                            <p style="color:red">采购中</p>
                                        @endif
                                    </td>
                                    <td>
                                        @if($v->purchase_status == 1)
                                            计划采购
                                            @elseif($v->purchase_status == 2)
                                        提前采购
                                            @endif
                                    </td>
                                    <td><a class="btn btn-info put_in_storage" href="/storage/setClothsStock?id={{ $v-> id }}">入库</a></td>
                                </tr>
                                @endforeach
                            @endif
                    </table>
                </div>
                <div style="float: right"><div style="float: right;margin:20px 0;"><button class="btn btn-info" onclick="returnPage()" style="float:right;">跳转</button><input type="text" class="form-control returnPage" style="width:6rem;float: right;margin:0 5px;"></div>{{$list->appends(['supplier'=>$where->supplier,'start_at'=>$where->start_at,'end_at'=>$where->end_at])->links()}}</div>
            </li>
        </ul>
    </div>
    <script type="text/javascript">
        $(function (){
            $(".jcDate").jcDate({
                IcoClass : "jcDateIco",
                Event : "click",
                Speed : 300,
                Left : 0,
                Top : 28,
                format : "-",
                Timeout : 100000
            });
        });
    </script>
@endsection
@section('script')
    @parent
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/jQuery-jcDate.js" type="text/javascript"></script>
    <script src="https://www.jq22.com/jquery/jquery-migrate-1.2.1.min.js"></script><!--JQ的版本引导-->
@endsection
